package com.cqrt.controller;


import com.alibaba.fastjson.JSONObject;


import com.cqrt.service.RTOutRuleService;
import com.github.zuihou.base.R;
import com.ty.basic.response.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping ("/api/outRule/v1")
@RestController
public class RTOutRuleController {

    @Resource
    private RTOutRuleService rtOutRuleService;

    @PostMapping("/check")
    public ResponseResult checkOutRule(@RequestBody String text) {
        JSONObject jsonObject = JSONObject.parseObject(text);
        try {
            rtOutRuleService.checkOutRule(jsonObject);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.fail("400",e.getMessage());
        }
        return ResponseResult.success();
    }
}
